﻿@{
    ViewBag.Title = "Index";
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>@(ViewBag.SiteName)管理平台登录</title>
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Administrator/Content/classic/style/style.css")" rel="stylesheet" type="text/css" />
</head>
<body style="height: auto; overflow-y: hidden;">
    <form id="form1">
    <script type="text/javascript">
    function submitform() {
        var username = $.trim($("[name='txtusername']").val());
        var password = $.trim($("[name='txtpassword']").val());
        var safecode = $.trim($("[name='txtsafecode']").val());
        if (username == "") {
            alert("请填写用户名");
            $("[name='txtusername']").focus();
            return;
        }
        if (password == "") {
            alert("请填写密码");
            $("[name='txtpassword']").focus();
            return;
        }
        if (safecode == "") {
            alert("请填写验证码");
            $("[name='txtsafecode']").focus();
            return;
        }
        var data = { username: username, password: password, safecode: safecode };
        var option={
            url:"@Url.Action("Index")",
            data:data,
            type:"POST",
            dataType:"json",
            success:function(json){
                if (!json.success) {
                    alert(json.errmsg);
                    $("#safecodeimg").click();
                    return;
                }else{
                    location.href = "@Url.Action("index", "home")";
                }
            }
        };
        $.ajax(option);
    }

    $(function () { 
        $("#safecodeimg").click(function() {
              var src = "@Url.RouteUrl("WebUtils_SafeCode")";
              $(this).attr("src", src+"?rnd="+new Date().getTime());
        });
    });
    </script>
    <div class="login">
        <div class="login_box">
            <div class="login_logo">
            </div>
            <div class="login_cont">
                <table width="260" cellpadding="0" cellspacing="6">
                    <tr>
                        <td width="53">
                            用户名：
                        </td>
                        <td colspan="2">
                            <input class="inputTxt" name="txtusername" type="text" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            密&nbsp;&nbsp;码：
                        </td>
                        <td colspan="2">
                            <input class="inputTxt" name="txtpassword" type="password" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            验证码：
                        </td>
                        <td width="96">
                            <input class="inputTxt2" maxlength="4" name="txtsafecode" type="text" runat="server" />
                        </td>
                        <td width="87">
                            <img id="safecodeimg" src="@Url.Content("~/Security/SafeCode")" alt="看不清楚，换一张"  style=" cursor:pointer" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td colspan="2">
                            <input type="button" class="dlBtn" id="Button1" onclick="submitform();" value=" "
                                name="Button1" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
